<extend name="Public/base"/>

<block name="body">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2>
            <if condition="ACTION_NAME eq 'add'">新增合同
                <else/>
               编辑合同
            </if>
        </h2>
    </div>
    <!-- 表单 -->
    <div class="with-padding">
        <form id="form" action="{:U('save')}" method="post" class="form-horizontal">
                
                <label class="item-label">合同编号:</label>                
                    <span class="input-large form-control form-input-width">{$data.id}</span>  
                 
                <label class="item-label">合同类型<span class="check-tips"></span></label>                
                    <input type="text" class="text input-large form-control form-input-width" name="httype"
                         value="{$data.httype}"> 
                                            
                <label class="item-label">项目名称<span class="check-tips"></span></label>                
                    <input type="text" class="text input-large form-control form-input-width" name="tecname"
                         value="{$data.tecname}">
                                      
         
                <label class="item-label">甲方(受让方)<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="rName"
                           value="{$data.rName}">
                </div>
                
                <label class="item-label">联系方式：<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="rName"
                           value="{$data.telephone}">
                </div>
                
                <label class="item-label">乙方(让与方)<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="rName"
                           value="{$data.rName}">
                </div>
                 
                <label class="item-label">联系方式：<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="rName"
                           value="{$data.ctelephone}">
                </div> 
                 
               <label class="item-label">有效期限<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="rName"
                  placeholder="**年或**月"       value="{$data.stime}">
                </div>
                
                <p class="item-label" style="float:left;font-size:15px">
			                    本合同乙方以 普通方式  许可甲方实施其所拥有的<span>{$data.tecname}</span>                                                             
			                 专利权，甲方受让该项专利的实施许可并支付相应的实施许可使用费。双方经过平等协商，在真实、充分地表达各自意愿的基础上，根据《中华人民共和国合同法》的规定，达成如下协议，并由双方共同恪守。
                </p>       		
<br/>
        <script>
            $(function () {
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                    auto: true,
                    // swf文件路径
                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    pick: '#upload_single_image_',
                    // 只允许选择图片文件
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                    if (data.status) {
                        $("[name='']").val(data.id);
                        $("[name='']").parent().find('.upload-pre-item').html(
                                '<input type="hidden" name="pic" value="'+ data.path+'"/><div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                        );
                        uploader_.reset();
                    } else {
                        updateAlert(data.info);
                        setTimeout(function () {
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled', false);
                        }, 1500);
                    }
                });
            })
        </script> 
<!-- 单图
		<div class="controls multiImage">
            <div id="upload_multi_image_" style="padding-bottom: 5px;">选择图片</div>
            <input class="attach" type="hidden" name="" value=""/>
            <div class="upload-img-box">
                <div class="upload-pre-item popup-gallery">

                                    </div>
            </div>
        </div>
        <script>
            $(function () {
                var id = "#upload_multi_image_";
                var limit = parseInt('');
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                      // swf文件路径                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "/duijie/admin.php?s=/file/uploadpicture/session_id/fuvf1hvfgihg9n5v6v63rc0022.html",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    //pick: '#upload_multi_image_',
                    pick: {'id': id, 'multi': true},
                    fileNumLimit: limit,
                    // 只允许选择图片文件。
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                uploader_.on('uploadFinished', function (file) {
                    uploader_.reset();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                          if (data.status) {
                            var ids = $("[name='']").val();
                            ids = ids.split(',');
                          if( ids.indexOf(data.id) == -1){
                                var rids = admin_image.upAttachVal('add',data.id, $("[name='']"));
                              if(rids.length>limit){
                                  updateAlert('超过图片限制');
                                  return;
                              }
                              $("[name='']").parent().find('.upload-pre-item').append(
                                        ' <div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                                '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                                );
                            }else{
                                updateAlert('该图片已存在');
                            }
                        } else {
                            updateAlert(data.info);
                            setTimeout(function () {
                                $('#top-alert').find('button').click();
                                $(that).removeClass('disabled').prop('disabled', false);
                            }, 1500);
                        }
                });
            })
            </div> 
        </script>-->
								
            <div class="form-item">
                <input type="hidden" name="id" value="{$data.id}"/>
                <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">{:L("_SURE_WITH_SPACE_")}</button>
                <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">{:L("_RETURN_WITH_SPACE_")}</button>
            </div>
       </form>      
       
    </div>
  
</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" charset="utf-8">
    Think.setValue('type', {$data.type|default = 1});
    Think.setValue('lstates', {$data.lstates|default = 1});
        //导航高亮
        highlight_subnav('{:U('Coninf/index')}');
    </script>
    
    <link type="text/css" rel="stylesheet" href="/duijie/Public/js/ext/magnific/magnific-popup.css"/>
    <script type="text/javascript" src="/duijie/Public/js/ext/magnific/jquery.magnific-popup.min.js"></script>

    <script type="text/javascript" charset="utf-8" src="/duijie/Public/js/ext/webuploader/js/webuploader.js"></script>
    <link href="/duijie/Public/js/ext/webuploader/css/webuploader.css" type="text/css" rel="stylesheet">


    <script>

        $(document).ready(function () {
            $('.popup-gallery').each(function () { // the containers for all your galleries
                $(this).magnificPopup({
                    delegate: 'a',
                    type: 'image',
                    tLoading: '正在载入 #%curr%...',
                    mainClass: 'mfp-img-mobile',
                    gallery: {
                        enabled: true,
                        navigateByImgClick: true,
                        preload: [0, 1] // Will preload 0 - before current, and 1 after the current image

                    },
                    image: {
                        tError: '<a href="%url%">图片 #%curr%</a> 无法被载入.',
                        titleSrc: function (item) {
                            /*           return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';*/
                            return '';
                        },
                        verticalFit: true
                    }
                });
            });
                    });
    </script>
</block>
